package com.colin.aiyi.dao.ImpxUtils;

import com.colin.aiyi.app.Constant;
import com.colin.aiyi.entity.response.BaseResponse;
import com.colin.aiyi.entity.WXRequest;

import org.xutils.http.RequestParams;

/**
 * Created by hl on 2017/5/5.
 */

public class ImpBindWXSendCode extends com.colin.aiyi.dao.ImpxUtils.AbsServicexUtils{

    @Override
    public void onSuccess(String result) {
        super.onSuccess(result);
        BaseResponse loginResponse=gson.fromJson(result,BaseResponse.class);
        loginResponse.setMsgType(Constant.CODE_bind_sendCode);
        if (callback==null)
        {
            sendMsgToView(BaseResponse.class,result);
        }else {
            callback.onSuccess(loginResponse);
        }
    }

    /*********
     * 注册

     参数名	必选	类型	说明
     telNo	是	string	手机号
     loginType	是	string	QQ:qq 微信：weixin
     openId	否	string	--
     clientSecret	否	string	--
     clientId	否	string	--
     */

    @Override
    public <V> void getObject(V v) {
        super.getObject(v);
            WXRequest user = (WXRequest) v;
            RequestParams params = new RequestParams(Constant.bind_sendCode);
            params.addBodyParameter("clientId", Constant.CLIENT_ID);
            params.addBodyParameter("clientSecret", Constant.CLIENT_SECRET);
            params.addBodyParameter("telNo", user.getTelNo());
            params.addBodyParameter("loginType", user.getLoginType());
            params.addBodyParameter("openId", user.getOpenId());
            sendToServer(params, 1);
    }




}
